﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace ggHD.WebSite.Controllers
{
    using ggHD.WebSite.TicketService;

    public class TicketsController : Controller
    {
        public enum PresentationType
        {
            Table = 0,
            TileByClients = 1,
            TileByInitiators = 2,
            TileByDate = 3
        }

        readonly ITicketService _ticketSvc = new TicketServiceClient();

        //
        // GET: /Tickets/
        public ActionResult Index()
        {
            return Tickets();
        }

        public ActionResult Tickets()
        {
            return Tickets(DateTime.Today.AddDays(-7), DateTime.Today, PresentationType.Table);
        }

        [HttpPost]
        public ActionResult Tickets(DateTime dateFrom, DateTime dateTo, PresentationType presType)
        {
            ViewBag.DateFrom = dateFrom;
            ViewBag.DateTo = dateTo;
            ViewBag.PresType = presType;

            var res = _ticketSvc.SelectHeaders(dateFrom,dateTo);

            return View("Tickets", res);
        }

        public ContentResult NewTicket()
        {
            return Content("");
        }
    }
}